home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 256 < prev    next >
Text File  |  1996-08-06  |  1KB  |  38 lines

  1. Path: bga.com!news
  2. From: makuch@bga.com (Michael Makuch)
  3. Newsgroups: comp.lang.c,comp.os.ms-windows.nt.misc,comp.programming,comp.std.c,comp.unix.aix
  4. Subject: function pointers
  5. Date: 31 Jan 1996 19:40:07 GMT
  6. Organization: Real/Time Communications - Bob Gustwick and Associates
  7. Message-ID: <4eogio$gt0@giga.bga.com>
  8. Mime-Version: 1.0
  9. X-RTcode: e791096531976b7d560fc565
  10. X-Newsreader: WinVN 0.99.4
  11.  
  12. The following c code segment compiles and works on
  13. NT MSVC++ and on SVR4 C compiler, but errors out
  14. on AIX with a type mismatch;
  15.  
  16. struct foostruct1 * myfoo1();
  17. struct foostruct2 * myfoo2();
  18. void *(*ptr)();
  19.  
  20. ptr = myfoo1;
  21. [snip]
  22. ptr = myfoo2;
  23.  
  24. I'm passing the function pointer ptr, to a function
  25. which then calls myfoo1, myfoo2, etc., etc. I can think
  26. of several work arounds but I'd rather get the AIX
  27. compiler to accept it. Is there a portable solution to
  28. get the AIX compiler to accept it? Casting the assignment
  29. as
  30.  
  31. prt = (struct foostruct1 *)myfoo1;
  32.  
  33. doesn't work either.
  34.  
  35. Thanx for any clues.
  36. mkm@abm.austin.tx.us
  37.  
  38.